﻿/*----------------------------------------------------------------
//   Copyright (C) 2012 YMSOFT All rights reserved 
//
//   CLR版本:   2.0.50727.3634
//   Namespace: ART.Common
//   FileName : MessageBox
//   Description: 
// 
//   Created by YAOMING at 2012-10-11 16:57:46
//   http://www.loverer.com QQ:78867011
//
//   Modified: 
//   Modify description: 
//
//----------------------------------------------------------------*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI;

namespace ART.Common
{
    public class MessageBox
    {
        public static void Alert(object sender, string strMessages)
        {
            Control control = (Control)sender;
            ScriptManager.RegisterClientScriptBlock(control, control.GetType(), control.UniqueID, "alert('" + strMessages + "');", true);
        }

        public static void AlertToAllUrl(object sender, string strMessages, string strToUrl)
        {
            Control control = (Control)sender;
            ScriptManager.RegisterClientScriptBlock(control, control.GetType(), control.UniqueID, "alert('" + strMessages + "');window.parent.location.href='" + strToUrl + "';", true);
        }

        public static void AlertToUrl(object sender, string strMessages, string strToUrl)
        {
            Control control = (Control)sender;
            ScriptManager.RegisterClientScriptBlock(control, control.GetType(), control.UniqueID, "alert('" + strMessages + "');location.href='" + strToUrl + "';", true);
        }

        public static void JSLoad(object sender, string strJS)
        {
            Control control = (Control)sender;
            ScriptManager.RegisterClientScriptBlock(control, control.GetType(), control.UniqueID, strJS, true);
        }

        public static void ToUrl(object sender, string strToUrl)
        {
            Control control = (Control)sender;
            ScriptManager.RegisterClientScriptBlock(control, control.GetType(), control.UniqueID, "location.href='" + strToUrl + "';", true);
        }

    }
}
